import request from './request'

// 获取消息列表
export const getMessages = (params) => {
  return request({
    url: '/messages',
    method: 'get',
    params
  })
}

// 获取未读消息数量
export const getUnreadMessageCount = () => {
  return request({
    url: '/messages/unread-count',
    method: 'get'
  })
}

// 标记单条消息为已读
export const markMessageAsRead = (messageId) => {
  return request({
    url: `/messages/${messageId}/read`,
    method: 'put'
  })
}

// 标记所有消息为已读
export const markAllMessagesAsRead = () => {
  return request({
    url: '/messages/read-all',
    method: 'put'
  })
}

// 删除单条消息
export const deleteMessage = (messageId) => {
  return request({
    url: `/messages/${messageId}`,
    method: 'delete'
  })
}

// 删除所有消息
export const deleteAllMessages = () => {
  return request({
    url: '/messages',
    method: 'delete'
  })
}